package com.wxxymakers.cklabrecruit.entity.enum_;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.biezhi.excel.plus.converter.Converter;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @AUTHOR soft
 * @DATE 2018/11/14 16:50
 * @DESCRIBE
 */
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.NUMBER_INT)
public enum RegStatus {
    REG("已报名"), STAGE1("通过笔试"), STAGE2("通过机试"), STAGE3("录取");

    @Getter
    private String name;

    public static RegStatus defaultV() {
        return REG;
    }

    public static class RegStatusConverter implements Converter<RegStatus> {

        @Override
        public String write(RegStatus value) {
            return value.name;
        }

        @Override
        public RegStatus read(String value) {
            for (RegStatus regStatus : RegStatus.values()) {
                if (regStatus.name.equals(value)) {
                    return regStatus;
                }
            }
            return RegStatus.REG;
        }
    }
}
